package com.bingfor.easycablelink.my;

import android.databinding.ObservableInt;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.DividerItemDecoration;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;
import android.view.MotionEvent;
import android.view.View;

import com.bingfor.easycablelink.R;
import com.bingfor.easycablelink.base.BaseRecyclerViewActivity;
import com.bingfor.easycablelink.base.WebViewActivity;
import com.bingfor.easycablelink.databinding.BaseRecyclerviewBinding;
import com.bingfor.easycablelink.utils.ActivityUtil;
import com.bingfor.easycablelink.widgets.RecyclerItemClickListener;

public class MessageListActivity extends BaseRecyclerViewActivity {

    BaseRecyclerviewBinding binding;
    MessageListAdapter adapter = new MessageListAdapter();

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        binding = BaseRecyclerviewBinding.inflate(getLayoutInflater());
        setContentView(binding.getRoot());
        initToolbar();
    }

    @Override
    public void initToolbar() {
        Toolbar toolbar = $(R.id.toolbar);
        setSupportActionBar(toolbar);
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        setTitle("通知");
        initViews();
    }

    @Override
    public void refresh() {

    }

    @Override
    public void initViews() {
        super.initViews();
        binding.setStatus(new ObservableInt(1));
        pageStatus.set(PAGE_STATUS_SHOW);
        mRecyclerView.setLayoutManager(mLayoutManager = new LinearLayoutManager(mContext));
//        mRecyclerView.addItemDecoration(new DividerItemDecoration(mContext, DividerItemDecoration.VERTICAL));
        mRecyclerView.setAdapter(adapter);
        mRecyclerView.addOnItemTouchListener(new RecyclerItemClickListener(mContext) {
            @Override
            public boolean onItemClick(View view, int position) {
                Bundle bundle = new Bundle();
                bundle.putString("title","通知详情");
                bundle.putString("url","https://www.baidu.com/");
                bundle.putBoolean("flag",true);
                moveToNextPage(WebViewActivity.class,bundle);
                return false;
            }
        });


    }

    @Override
    public void reload() {

    }
}
